#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#define int long long
using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n + 10);   
    vector<int> sum(n + 10);   
    for(int i = 1; i <= n; i ++) 
    {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
        //cout << sum[i] << ' ';
    }
    if(n == 2)
    {
        cout << a[1] + a[2] << ' ' << 0 <<  endl;
        return;
    }
    //cout << endl;
    int res = 0;
    int res1 = 0;
    int cnt = 0;
    if(n % 2 == 1) cnt = (n - 1) / 2;
    else cnt = (n - 2) / 2;
    for(int i = 0; i <= n; i ++)
    {
        int l = i;
        int r = cnt - i;
        if(r < 0) break;
        int ans = sum[i] - sum[0] + sum[n] - sum[n - r];
        //cout << ans << ' ';
        if(ans > res)
        {
            res = ans;
            res1 = sum[n - r] - sum[l];
        }
    }
    //cout << endl;
    cout << res1 << ' ' << res << endl;
}

signed main()
{
    int t;
    cin >> t;
    while(t--)
    {
       solve(); 
    }
}